//
//  ViewController.m
//  DemoAlertView
//
//  Created by tangkexiong on 15/9/23.
//  Copyright (c) 2015年 tangkexiong. All rights reserved.
//

#import "ViewController.h"

#import "YCLabelAlertView.h"

@interface ViewController ()<YCLabelAlertViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)showLabelAlertView:(id)sender {
    YCLabelAlertView *alert = [[YCLabelAlertView alloc] initWithTitle:@"哈哈" message:nil delegate:self cancelButtonImg:[UIImage imageNamed:@"post_dlg_close"] otherButtonTitles:@"试试", @"确定", nil];
    NSString *str = @"东啊感觉第几噶结果\n到噶高低贵\n贱奥感觉到根\n深蒂固";
    NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:str];
    [attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, str.length)];
    alert.contentLabel.attributedText = attrStr;
    [alert showInViewController:self];
}

- (void)labelAlertView:(YCLabelAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSLog(@"%@", @(buttonIndex));
}

- (void)labelAlertViewClickedCancelButton:(YCLabelAlertView *)alertView {
    NSLog(@"cancel");
}

@end
